<?php 
require 'ShoppingCartMySQL.php';

?>

<!DOCTYPE html>

<html>
  <head>
    <title>Socken und Hosen Laden</title>
    <meta charset="UTF-8" />
    <meta name="description" content="In diesem Laden kann man Hosen und Socken kaufen" />
    
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="shop.js"></script>
    
    <link href="layout.css" rel="stylesheet" type="text/css" media="screen" />
  </head>
  <body>
    <div class="header">
    	<a id="login" class="action_button" href="javascript:shop.showLogin()" style="display:none;float:left;">Login</a>
    	<a id="logout" class="action_button" href="javascript:shop.logout()" style="display:none;float:left;">Logout</a>
    	<a class="action_button" href="ShoppingCartOverview.php" style="display:block;">Zum Warenkorb</a>
    </div>
    <div id="loginForm" style="display:none">
    	<form action="">
    		<input type="text" name="username" id="username">
    		<input type="password" name="password" id="password">
    		<a href="javascript:shop.login()" class="action_button">Login</a> 
    	</form>
    </div>
    <ul class="pricing_table">
      <?php 
        $shoppingCartMYSQL = new ShoppingCartMySQL("swa015", "swa015", "Pei7Ahr");
        $allProducts = $shoppingCartMYSQL->getAllProducts();
        
        
        foreach ($allProducts as $value)
        {
      ?>
        <li class="price_block">:
			<h3><?php echo $value->name ?></h3>
			<div>
				<img src="data:image/jpeg;base64,<?php echo base64_encode($value->picture); ?>" alt="" />
			</div>
			<div class="price">
				<div class="price_figure">
					<span class="price_number"><?php echo $value->price . " Euro"?></span>
				</div>
			</div>
                <div class="price">
				<span><?php echo $value->description?></span>
			</div>
			<div class="footer">
                <input id="<?php echo "quantity" . $value->id?>" style="display:block; float:left; width:40px" type="number" name="Anzahl"></input>
				<a href="javascript:shop.addProduct(<?php echo $value->id?>)" class="action_button">In Cart</a>
			</div>
		</li>
      <?php 
        }
      ?>    
    </ul>
  </body>
</html>